package STUDENT.TRANDAODAIVI.OOPs.BaitapOOPEX2;
import java.util.Scanner;
class MyInteger{
	int value;
	public MyInteger(int value){
		this.value=value;
	}
	public int getValue(){
		return value;
	}
	//TH1
	public boolean isEven(){
		if (value%2==0){return true;}
		return false;
	}
	public boolean isOdd(){
		if (value%2!=0){return true;}
		return false;
	}
	public boolean isPrime(){
		int sum=0;
		for (int i=1;i<value;i=i+1){
			if(value%i==0){
				sum=sum+1;
			}
		}
		if(sum ==1){return true;}
		return false;
	}
	//TH2
	public static boolean isEven(int value){
		if (value%2==0){return true;}
		return false;
	}
	public static boolean isOdd(int value){
		if (value%2!=0){return true;}
		return false;
	}
	public static boolean isPrime(int value){
		int sum=0;
		for (int i=1;i<value;i=i+1){
			if(value%i==0){
				sum=sum+1;
			}
		}
		if(sum ==1){return true;}
		return false;
	}
	//TH3
	public static boolean isEven(MyInteger obj){
		if (obj.getValue()%2==0){return true;}
		return false;
	}
	public static boolean isOdd(MyInteger obj){
		if (obj.getValue()%2!=0){return true;}
		return false;
	}
	public static boolean isPrime(MyInteger obj){
		int sum=0;
		for (int i=1;i<obj.getValue();i=i+1){
			if(obj.getValue()%i==0){
				sum=sum+1;
			}
		}
		if(sum ==1){return true;}
		return false;
	}
	//1 So sanh 1 obj vs 1 so bat ki
	public boolean equals(int value){
		if (this.getValue()==value){
			return true;
		}
		return false;
	}
	//2 So sanh 1 obj va 1 obj
	public boolean equals(MyInteger obj){
		if (this.getValue()==obj.getValue()){return true;}
			return false;
	}
	//3 So sang 1 so bat ki va 1 obj ????????
	//Transfer
	public static int parseInt(String word){
		return Integer.parseInt(word);
	}
}
public class BT6 {
	public static void main(String[] args) {
		MyInteger obj1=new MyInteger(8);
		MyInteger obj2=new MyInteger(9);
		MyInteger obj3=new MyInteger(5);
		//Test get method:
		System.out.println(obj1.getValue()+" "+obj2.getValue()+" "+obj3.getValue());
		//TH1.
		if(obj1.isEven()){System.out.println("So chan");}else{System.out.println("Khong phai");}
		if(obj2.isOdd()){System.out.println("So le");}else{System.out.println("Khong phai");}
		if(obj3.isPrime()){System.out.println("So nguyen to");}else{System.out.println("Khong phai");}
		if(obj1.isPrime()){System.out.println("So nguyen to");}else{System.out.println("Khong phai");}
		System.out.println("");
		//TH2.
		if(MyInteger.isEven(8)){System.out.println("So chan");}else{System.out.println("Khong phai");}
		if(MyInteger.isOdd(9)){System.out.println("So le");}else{System.out.println("Khong phai");}
		if(MyInteger.isPrime(5)){System.out.println("So nguyen to");}else{System.out.println("Khong phai");}
		if(MyInteger.isPrime(8)){System.out.println("So nguyen to");}else{System.out.println("Khong phai");}
		System.out.println("");
		//TH3
		if(MyInteger.isEven(obj1)){System.out.println("So chan");}else{System.out.println("Khong phai");}
		if(MyInteger.isOdd(obj2)){System.out.println("So le");}else{System.out.println("Khong phai");}
		if(MyInteger.isPrime(obj3)){System.out.println("So nguyen to");}else{System.out.println("Khong phai");}
		if(MyInteger.isPrime(obj1)){System.out.println("So nguyen to");}else{System.out.println("Khong phai");}
		//1
		MyInteger obj4=new MyInteger(4);
		if(obj4.equals(1)){System.out.println("=");}else{System.out.println("!=");}
		//2
		MyInteger obj5=new MyInteger(3);
		if(obj5.equals(obj4)){System.out.println("=");}else{System.out.println("!=");}
		
		//Transfer
		System.out.print("Input String number: ");
		Scanner sc=new Scanner(System.in);
		String g=sc.nextLine();
		System.out.println("After Transfer: " +MyInteger.parseInt(g));
		
		
	}

}
